<script type="text/javascript">
$(function () {
	var url = '${contextPath}script/el/topic.js';
	$.ajax({url:url, dataType:'script', cache:true,
		success: function(){
			calcCodes_topic();
		}
	});
});
</script>
<style>
.my-filter-table {
	background: linear-gradient(to bottom, #F1FAFE 0%, #D9EDF7 100%) repeat scroll 0 0 rgba(0, 0, 0, 0);
	border: 1px solid #9BE2F0;
	display: inline-block;
	margin-bottom: 5px;
	margin-left: 5px;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.my-filter-table a {
	color: #3A87AD;
    display: inline-block;
    margin: 0 4px;
}

.my-filter-table button {
	background: none repeat scroll 0 0 rgba(0, 0, 0, 0);
    border: 0 none;
    cursor: pointer;
    padding: 0;
    color: #000000;
    float: right;
    font-size: 20px;
    font-weight: bold;
    line-height: 20px;
    opacity: 0.4;
    text-shadow: 0 1px 0 #FFFFFF;
}

.add-tag-input {
	width:80px;
}
</style>
<#import "/freemarker/modeltype.ftl" as mt>
<#import "/freemarker/modeltype_entity.ftl" as mte>
<div>
	<h3 class="title">编辑题目信息</h3>
</div>
<div class="widget">
	<div class="widget-content">
		<form id="editTopicFrom" >
			<td>课 程<a href="javascript:;" onclick="chooseCourse_topic();return false;" ><span style="color:blue;">[添加]</span></a></td>
			<div id="courseDiv" <#if list??><#else>style="display: none;"</#if> >
				<table class="table table-bordered"  style="width: 400px;">
					<tbody id="courseTbody">
						<#list list as c>
						<tr class="footable-even" style="display: table-row;">
							<td>${c.name}</td>
							<td style="width: 60px;">
								<input type="hidden" class="yxCode" value="${(c.code)!''}" />
								<button class="btn btn-xs btn-danger" onclick="javascript: deletedCourses_topic($(this)); return false;" title="删除">
									<i class="icon-remove"></i>
								</button>
							</td>
						</tr>
						</#list>
					</tbody>
				</table>
			</div>
			<table class="table table-bordered" style="width:400px; text-align:left;">
				<tr>
					<td>题目难度</td>
					<td>
						<@mte.TopicDifficulty id="level" value=((info.tdc)!'') nullstr='请选择' name="tdc"/>
					</td>
				</tr>
				<tr>
					<td>题干</td>
					<td>
						<textarea id="content"  name="content">${(info.content)!''}</textarea>
						<input type="hidden" name="code" value="${(info.code)!''}" /> 
						<input type="hidden" id="ct" name="ct" value="${(info.ct)!''}"/>
						<input type="hidden" id="cu" name="cu" value="${(info.cu)!''}"/>
						<input type="hidden" id="oc" name="oc" value="${(info.oc)!''}"/>
						<input type="hidden" value="" name="codes" id="codes"/>
					</td>
				</tr>
				<tr>
					<td>题目类型</td>
					<td>
						<@mte.Problemtype id="tType" value=((info.type)!'') nullstr='请选择' name="type"  classname="form-control" onchange="showAnswers_topic();return false;"/>
					</td>
				</tr>
			</table>
			<table class="table table-bordered" data-page-size="5" data-filter="#filter" ui-jq="footable" style="width:400px;">
				<thead id="theadDiv">
					<#if info?? && info.type??>
					<#if info.type == "1" || info.type == "2">
					<tr>
						<th>答案<a href="javascript:;" onclick="addRow_topic();return false;" ><span style="color:blue;">[添加空白行]</span></a></th>
						<th>正确选项</th>
						<th>操作</th>
					</tr>
					<#else>
					<tr>
						<th style="width:100%;text-align: center;" >参考答案</th>
					</tr>
					</#if>
					</#if>
				</thead>
				<tbody id="addTbody">
					<#assign i = 0 />
					<#if info??>
					<#list info.itemList as item>
					<tr class="footable-even" style="display: table-row;">
						<#if info.type == "1" || info.type == "2">
						<td>
							<input type="text" class="form-control"  name="itemList[${i}].answer" value="${(item.answer)!''}"/>
							<input type="hidden" class="form-control"  name="itemList[${i}].code" value="${(item.code)!''}"/>
						</td>
						</#if>
						<td class="footable-visible footable-first-column" style="text-align: center;">
							<#if info.type == "1">
							<input class="xuanze ro" type="radio" onclick="javascript:onlyRadio_topic($(this));" value="true" name="itemList[${i}].isRight" <#if item.isRight?? && item.isRight>checked="checked"</#if> /><i></i>
							<#elseif info.type == "2">
							
								<div class="checkbox">
								    <label class="i-checks">
								        <input class="xuanze cx" type="checkbox" value="true" name="itemList[${i}].isRight" <#if item.isRight?? && item.isRight>checked="checked"</#if>/><i></i>
								    </label>
								</div>
							<#else>
								<tr style="display: table-row;">
									<td class="footable-visible footable-first-column" style="width:100%;text-align: center;">
										<div class="col-sm-8">
											<textarea  class="form-control jd" name="itemList[${i}].answer" rows="5" style="width:450px;">${item.answer!''}</textarea>
											<input type="hidden" value="true" class="da" name="itemList[${i}].isRight"/>
										</div>
									</td>
								</tr>
							</#if>
						</td>
						<#if info.type == "1" || info.type == "2">
						<td>
							<button class="btn btn-xs btn-danger" onclick="javascript:deleteRow_topic($(this)); return false;" title="删除">
							<i class="icon-remove"></i>
						</td>
						</#if>
					</tr>
					<#assign i = i + 1 />
					</#list>
					</#if>
					<input type="hidden" id="index" value="${i}"/>
				</tbody>
				<tr>
					<td style="text-align: center;" colspan="3">
						<button class="btn btn-info" onclick="javascript: checkSave_topic(); return false;" title="保存" ><i class="icon-save"></i>保存</button>&nbsp;&nbsp;&nbsp;
						<button class="btn btn-primary" onclick="javascript: sys_load_handle('topic'); return false;" title="取消">取消</button>
					</td>
				</tr>
			</table>
			
		</form>
	</div>
</div>
<table style="display: none;width:400px; text-align:left;" id="addTable" >
	<tr class="addrad" style="display: table-row;">
		<td>
			<input type="text" style="width:200px;"/>
		</td>
		<td style="text-align: center;">
			<input type="radio" class="ro" value="true"  onclick="javascript:onlyRadio_topic($(this));"/><i></i>
		</td>
		<td>
			<button class="btn btn-xs btn-danger" onclick="javascript:deleteRow_topic($(this)); return false;" title="删除">
			<i class="icon-remove"></i>
		</td>
	</tr>
	<tr class="addche" style="display: table-row;">
		<td>
			<input type="text"/>
		</td>
		<td style="text-align: center;">
			<input type="checkbox" class="cx" value="true" /><i></i>
		</td>
		<td>
			<button class="btn btn-xs btn-danger" onclick="javascript:deleteRow_topic($(this));" title="删除">
			<i class="icon-remove"></i>
		</td>
	</tr>
	<tr class="addjd" style="display: table-row;">
		<td style="width:100%;text-align: center;">
			<textarea  class="form-control jd" rows="5" style="width:450px;"></textarea>
			<input type="hidden" value="true" class="da" />
		</td>
	</tr>
	<tr class="thead1">
		<th>答案<a href="javascript:;" onclick="addRow_topic();return false;" ><span style="color:blue;">[添加空白行]</span></a></th>
		<th>正确选项</th>
		<th>操作</th>
	</tr>
	<tr class="thead2">
		<th data-toggle="true" style="width:100%;text-align: center;" >参考答案</th>
	</tr>
</table>